using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CocaCola_Inventory_System.Data_Access;
using System.Data.Odbc;

namespace CocaCola_Inventory_System_Configuration
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if(Registery.saveConnectionString(textBox1.Text))
                MessageBox.Show("Connection String Saved Successfully , Please Restart The Application"); 
            else
                MessageBox.Show("Failed To Save Connection String");
        }

        private void button2_Click(object sender, EventArgs e)
        {

            try
            {
                OdbcConnection con = new OdbcConnection(Registery.GetConnectionString());
                con.Open();
                con.Close();
                MessageBox.Show("Connection succeeded");

            }
            catch (Exception ex)
            {
                MessageBox.Show("Connection Failed");
            }
        }
    }
} 